#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[]){

	int char_ascii = 0;
	int i = 0;
	int inputc;
	while( ( (inputc = getchar()) != EOF ) ){
		/*
		 * i: Itera en ciclos de 8, se usa para la potencia
		 * 		y cada 8 ciclos se resetea e imprime en archout
		 *  */
		// Input is not binary
		if (inputc != '0' && inputc != '1')
		{
			if (inputc == ' ' || inputc == '\n')
				continue;
			// Input has errors
			fprintf(stderr, "\nINPUT_ERROR: Binary input file should only contain 1's and 0's.\n");
			return EXIT_FAILURE;
		}
		// Input ok
		i++;
		int bin = inputc - '0';
		char_ascii += (bin * (1 << (8-i)));
		if (i == 8){
			i = 0;
			printf("%c", char_ascii);
			char_ascii = 0;
		}
	}
	if (i != 0){
		fprintf(stderr, "\nINPUT_ERROR: Binary input file has not an entire amount of bytes.\n");
		return EXIT_FAILURE;
	}
	return EXIT_SUCCESS;
}



